﻿using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;

namespace Easy.Domain.Core
{
    public interface IUnitOfWork : IDisposable
    {
        string ConnectionString { get; }

        DbEntityEntry Entry(object entity);

        DbEntityEntry<T> Entry<T>(T entity) where T : class;

        DbSet Set(Type entityType);

        DbSet<T> Set<T>() where T : class;

        void Attach<T>(T item) where T : class;

        void Detach<T>(T item) where T : class;

        void SetModified<T>(T item) where T : class;

        void ApplyCurrentValues<T>(T toOriginal, T formCurrent) where T : class;

        void Commit();

        void RollbackStateChanges();

        void Clear();
    }
}
